<?php
if (!defined('IN_DISCUZ')){
	exit('Access Denied');
}

global $_G;

if (!$_G['uid']){
	showmessage('postperm_login_nopermission', NULL, array(), array(
			'login'=>1
	));
}

if ($_G['adminid'] != 1){
	showmessage('ban_khong_phai_admin');
}

$page = empty($_GET['page']) ? 1 : intval($_GET['page']);

if ($page < 1)
	$page = 1;

$perpage = 5;
$start = ($page - 1) * $perpage;
$limit = $start + $perpage;

$query = DB::query("SELECT s.*, c.name AS cat_name
					FROM " . DB::table('shop_profile') . " s
					LEFT JOIN " . DB::table("shop_category") . " c ON s.sid = c.sid
					ORDER BY dateline DESC
					LIMIT $start, $perpage");

$count = getcount('shop_profile');

$members = array();

while ($member = DB::fetch($query)){
	$members[] = $member;
}

$multi = multi($count, $perpage, $page, 'shop.php?mod=store&ac=estore');

/*
 * So luong san pham
 * cua gian hang
 * */
function itemShop($uid = 0){
	return getcount('shop_products', 'uid = ' . $uid . ' AND hide = 0');
}


//var_dump($members);